package com.fastwire.carriere.serviceorder.vo;

import java.util.Date;
import java.util.List;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.Root;

import com.fastwire.carriere.serviceorder.entity.ProductInfo;
import com.fastwire.carriere.serviceorder.entity.ServiceOrder;
import com.fastwire.carriere.serviceorder.entity.ServiceOrderActivity;
import com.google.common.collect.Lists;

@Root(name = "ServiceOrderVo")
public class ServiceOrderVo {
	@Attribute(required = false)
	private String workOrderNo;
	@Attribute(required = false)
	private String customerName;
	@Attribute(required = false)
	private Date customerReqDate;
	@Attribute(required = false)
	private String orderActionType;
	@Attribute(required = false)
	private String serviceType;
	@Attribute(required = false)
	private String workOrderType;
	@Attribute(required = false)
	private String priority;
	@Attribute(required = false)
	private String serviceActionType;
	@Attribute(required = false)
	private String orderStatus;
	@Attribute(required = false)
	private Date orderCreateDate;
	@Attribute(required = false)
	private String serviceId;
	@Attribute(required = false)
	private String projectId;
	@Attribute(required = false)
	private Date orderSubmitDate;
	@Attribute(required = false)
	private String newInstallAddrA;
	@Attribute(required = false)
	private String newInstallNameA;
	@Attribute(required = false)
	private String newExchangeCodeA;
	@Attribute(required = false)
	private String newInstallAddrB;
	@Attribute(required = false)
	private String newInstallNameB;
	@Attribute(required = false)
	private String newExchangeCodeB;
	@Attribute(required = false)
	private String existingInstallAddrA;
	@Attribute(required = false)
	private String existingInstallNameA;
	@Attribute(required = false)
	private String existingExchangeCodeA;
	@Attribute(required = false)
	private String existingInstallAddrB;
	@Attribute(required = false)
	private String existingInstallNameB;
	@Attribute(required = false)
	private String existingExchangeCodeB;
	@Attribute(required = false)
	private String installerName;
	@ElementList(name = "Activities", required = false)
	private List<ActivityVo> activities;
	@ElementList(name = "Products", required = false)
	private List<ProductInfoVo> productInfos;

	private String lastUpdatedby;

	public ServiceOrderVo() {
		super();
		// TODO Auto-generated constructor stub
	}

	public ServiceOrderVo(ServiceOrder serviceOrder) {
		super();
		this.workOrderNo = serviceOrder.getWorkOrderNo();
		this.customerName = serviceOrder.getCustomerName();
		this.customerReqDate = serviceOrder.getCustomerReqDate();
		this.orderActionType = serviceOrder.getOrderActionType();
		this.serviceType = serviceOrder.getServiceType();
		this.workOrderType = serviceOrder.getWorkOrderType();
		this.priority = serviceOrder.getPriority();
		this.serviceActionType = serviceOrder.getServiceActionType();
		this.orderStatus = serviceOrder.getOrderStatus();
		this.orderCreateDate = serviceOrder.getOrderCreateDate();
		this.serviceId = serviceOrder.getServiceId();
		this.projectId = serviceOrder.getProjectId();
		this.orderSubmitDate = serviceOrder.getOrderSubmitDate();
		this.newInstallAddrA = serviceOrder.getNewInstallAddrA();
		this.newInstallNameA = serviceOrder.getNewInstallNameA();
		this.newExchangeCodeA = serviceOrder.getNewExchangeCodeA();
		this.newInstallAddrB = serviceOrder.getNewInstallAddrB();
		this.newInstallNameB = serviceOrder.getNewInstallNameB();
		this.newExchangeCodeB = serviceOrder.getNewExchangeCodeB();
		this.existingInstallAddrA = serviceOrder.getExistingInstallAddrA();
		this.existingInstallNameA = serviceOrder.getExistingInstallNameA();
		this.existingExchangeCodeA = serviceOrder.getExistingExchangeCodeA();
		this.existingInstallAddrB = serviceOrder.getExistingInstallAddrB();
		this.existingInstallNameB = serviceOrder.getExistingInstallNameB();
		this.existingExchangeCodeB = serviceOrder.getExistingExchangeCodeB();
		this.installerName = serviceOrder.getInstallerName();

		if (serviceOrder.getActivities() != null) {
			List<ActivityVo> activityVos = Lists.newArrayList();
			for (ServiceOrderActivity activity : serviceOrder.getActivities()) {
				if (activity != null)				
					activityVos.add(new ActivityVo(activity));
			}

			setActivities(activityVos);
		}

		if (serviceOrder.getProductInfos() != null) {
			List<ProductInfoVo> productVos = Lists.newArrayList();
			for (ProductInfo productInfo : serviceOrder.getProductInfos()) {
				if (productInfo!=null)
					productVos.add(new ProductInfoVo(productInfo));
			}

			setProductInfos(productVos);
		}

	}

	public List<ActivityVo> getActivities() {
		return activities;
	}

	public void setActivities(List<ActivityVo> activities) {
		this.activities = activities;
	}

	public List<ProductInfoVo> getProductInfos() {
		return productInfos;
	}

	public void setProductInfos(List<ProductInfoVo> productInfos) {
		this.productInfos = productInfos;
	}

	public String getWorkOrderNo() {
		return workOrderNo;
	}

	public void setWorkOrderNo(String workOrderNo) {
		this.workOrderNo = workOrderNo;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public Date getCustomerReqDate() {
		return customerReqDate;
	}

	public void setCustomerReqDate(Date customerReqDate) {
		this.customerReqDate = customerReqDate;
	}

	public String getOrderActionType() {
		return orderActionType;
	}

	public void setOrderActionType(String orderActionType) {
		this.orderActionType = orderActionType;
	}

	public String getServiceType() {
		return serviceType;
	}

	public void setServiceType(String serviceType) {
		this.serviceType = serviceType;
	}

	public String getWorkOrderType() {
		return workOrderType;
	}

	public void setWorkOrderType(String workOrderType) {
		this.workOrderType = workOrderType;
	}

	public String getPriority() {
		return priority;
	}

	public void setPriority(String priority) {
		this.priority = priority;
	}

	public String getServiceActionType() {
		return serviceActionType;
	}

	public void setServiceActionType(String serviceActionType) {
		this.serviceActionType = serviceActionType;
	}

	public String getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(String orderStatus) {
		this.orderStatus = orderStatus;
	}

	public Date getOrderCreateDate() {
		return orderCreateDate;
	}

	public void setOrderCreateDate(Date orderCreateDate) {
		this.orderCreateDate = orderCreateDate;
	}

	public String getServiceId() {
		return serviceId;
	}

	public void setServiceId(String serviceId) {
		this.serviceId = serviceId;
	}

	public String getProjectId() {
		return projectId;
	}

	public void setProjectId(String projectId) {
		this.projectId = projectId;
	}

	public Date getOrderSubmitDate() {
		return orderSubmitDate;
	}

	public void setOrderSubmitDate(Date orderSubmitDate) {
		this.orderSubmitDate = orderSubmitDate;
	}

	public String getNewInstallAddrA() {
		return newInstallAddrA;
	}

	public void setNewInstallAddrA(String newInstallAddrA) {
		this.newInstallAddrA = newInstallAddrA;
	}

	public String getNewInstallNameA() {
		return newInstallNameA;
	}

	public void setNewInstallNameA(String newInstallNameA) {
		this.newInstallNameA = newInstallNameA;
	}

	public String getNewExchangeCodeA() {
		return newExchangeCodeA;
	}

	public void setNewExchangeCodeA(String newExchangeCodeA) {
		this.newExchangeCodeA = newExchangeCodeA;
	}

	public String getNewInstallAddrB() {
		return newInstallAddrB;
	}

	public void setNewInstallAddrB(String newInstallAddrB) {
		this.newInstallAddrB = newInstallAddrB;
	}

	public String getNewInstallNameB() {
		return newInstallNameB;
	}

	public void setNewInstallNameB(String newInstallNameB) {
		this.newInstallNameB = newInstallNameB;
	}

	public String getNewExchangeCodeB() {
		return newExchangeCodeB;
	}

	public void setNewExchangeCodeB(String newExchangeCodeB) {
		this.newExchangeCodeB = newExchangeCodeB;
	}

	public String getExistingInstallAddrA() {
		return existingInstallAddrA;
	}

	public void setExistingInstallAddrA(String existingInstallAddrA) {
		this.existingInstallAddrA = existingInstallAddrA;
	}

	public String getExistingInstallNameA() {
		return existingInstallNameA;
	}

	public void setExistingInstallNameA(String existingInstallNameA) {
		this.existingInstallNameA = existingInstallNameA;
	}

	public String getExistingExchangeCodeA() {
		return existingExchangeCodeA;
	}

	public void setExistingExchangeCodeA(String existingExchangeCodeA) {
		this.existingExchangeCodeA = existingExchangeCodeA;
	}

	public String getExistingInstallAddrB() {
		return existingInstallAddrB;
	}

	public void setExistingInstallAddrB(String existingInstallAddrB) {
		this.existingInstallAddrB = existingInstallAddrB;
	}

	public String getExistingInstallNameB() {
		return existingInstallNameB;
	}

	public void setExistingInstallNameB(String existingInstallNameB) {
		this.existingInstallNameB = existingInstallNameB;
	}

	public String getExistingExchangeCodeB() {
		return existingExchangeCodeB;
	}

	public void setExistingExchangeCodeB(String existingExchangeCodeB) {
		this.existingExchangeCodeB = existingExchangeCodeB;
	}

	public String getInstallerName() {
		return installerName;
	}

	public void setInstallerName(String installerName) {
		this.installerName = installerName;
	}

	public String getLastUpdatedby() {
		return lastUpdatedby;
	}

	public void setLastUpdatedby(String lastUpdatedby) {
		this.lastUpdatedby = lastUpdatedby;
	}

}
